﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Deb.Drivers;
using EnvDTE;
using System.Diagnostics;

namespace Mapper
{
    public class MappingUnit
    {
        //DebuggingFunctions db = new DebuggingFunctions();
        VSDriver vs = new VSDriver();

        public void GestureMapping(EnvDTE.DTE ide, string gesture)
        {

            try
            {

                switch (ide.Debugger.CurrentMode)
                {
                    case dbgDebugMode.dbgDesignMode:
                        switch (gesture)
                        {
                            case "RightHello":
                                Debug.WriteLine("RightHello!");
                                vs.GoDebugger(ide);
                                break;
                        }
                        break;
                    case dbgDebugMode.dbgRunMode:
                        switch (gesture)
                        {
                            case "LeftHello":
                                Debug.WriteLine("LeftHello!");
                                vs.BreakDebugger(ide);
                                break;
                            case "HandsJoined":
                                Debug.WriteLine("HandsJoined!");
                                vs.StopDebugger(ide);
                                break;
                        }
                        break;
                    case dbgDebugMode.dbgBreakMode:
                        switch (gesture)
                        {
                            case "RightHello":
                                Debug.WriteLine("RightHello!");
                                vs.GoDebugger(ide);
                                break;
                            case "HandsJoined":
                                Debug.WriteLine("HandsJoined!");
                                vs.StopDebugger(ide);
                                break;
                            case "SwipeToRight":
                                Debug.WriteLine("SwipeToRight!");
                                vs.StepIntoDebugger(ide);
                                break;
                            case "SwipeToLeft":
                                Debug.WriteLine("SwipeToLeft!");
                                vs.StepOutDebugger(ide);
                                break;
                            case "Circle":
                                Debug.WriteLine("Circle!");
                                vs.StepOverDebugger(ide);
                                break;

                        }
                        break;
                }

            }
            catch (System.Exception ex)
            {
                Debug.WriteLine("Debugger.CurrentMode Exception: {0}", ex);
            }

        }

        public void SpeechMapping(EnvDTE.DTE ide, string speechCommand)
        {

            try
            {

                switch (ide.Debugger.CurrentMode)
                {
                    case dbgDebugMode.dbgDesignMode:
                        switch (speechCommand)
                        {
                            case "START":
                                Debug.WriteLine("START!");
                                vs.GoDebugger(ide);
                                break;
                        }
                        break;
                    case dbgDebugMode.dbgRunMode:
                        switch (speechCommand)
                        {
                            case "BREAK":
                                Debug.WriteLine("BREAK!");
                                vs.BreakDebugger(ide);
                                break;
                            case "STOP":
                                Debug.WriteLine("STOP!");
                                vs.StopDebugger(ide);
                                break;
                        }
                        break;
                    case dbgDebugMode.dbgBreakMode:
                        switch (speechCommand)
                        {
                            case "GO":
                                Debug.WriteLine("GO!");
                                vs.GoDebugger(ide);
                                break;
                            case "STOP":
                                Debug.WriteLine("STOP!");
                                vs.StopDebugger(ide);
                                break;
                            case "STEP INTO":
                                Debug.WriteLine("STEP INTO!");
                                vs.StepIntoDebugger(ide);
                                break;
                            case "STEP OUT":
                                Debug.WriteLine("STEP OUT!");
                                vs.StepOutDebugger(ide);
                                break;
                            case "STEP OVER":
                                Debug.WriteLine("STEP OVER!");
                                vs.StepOverDebugger(ide);
                                break;

                        }
                        break;
                }

            }
            catch (System.Exception ex)
            {
                Debug.WriteLine("Debugger.CurrentMode Exception: {0}", ex);
            }

        }

    }
}
